package com.syni.mdd.yhd.common.all.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @className 称号列表
 * @description TOO
 * @Author cfx
 * @DATE 2019/4/16 17:23
 * @VERSION 1.0
 **/
public class DesignationUtils {
    public static final String rookieDes = "探店菜鸟";

    public static final String newPeopleDes = "探店新人";

    public static final String youngsterDes = "探店新秀";

    public static final String specialistDes = "探店专家";

    public static final String kingDes = "探店王者";

    //菜鸟等级（n < 0.1）
    public static final double rookieLevel = 0.1;
    //新人等级（0.1 < n < 0.3）
    public static final double newPeopleLevel = 0.3;
    //新秀等级（0.1 < n < 1）
    public static final double youngsterLevel = 1;
    //专家等级（1 < n < 1.5）（n > 1.5为王者等级）
    public static final double specialistLevel = 1.5;

    //称号图
    public static final Map<String,Object> desNameToImgMap = new HashMap<>();

    //城市区域分布图
    public static final Map<String,String> cityToImgMap = new HashMap<>();

    static {
        cityToImgMap.put("珠海市","static/images/cityZhuHai.jpg");
        cityToImgMap.put("广州市","static/images/cityGuangZhou.jpg");
        cityToImgMap.put("珠海市_广州市","static/images/cityZhuHaiGuangZhou.jpg");
        cityToImgMap.put("广州市_珠海市","static/images/cityZhuHaiGuangZhou.jpg");
    }

    public static String getImgPath(String desKey){
        if(cityToImgMap.containsKey(desKey)){
            return cityToImgMap.get(desKey);
        }
        return "";
    }

    public static String getDesignation(Integer businessNum,Integer passDay){
        double n = businessNum / (double)passDay;
        if(n > DesignationUtils.specialistLevel){
            return DesignationUtils.kingDes;
        }else if(n >= DesignationUtils.youngsterLevel && n < DesignationUtils.specialistLevel){
            return DesignationUtils.specialistDes;
        }else if(n >= DesignationUtils.newPeopleLevel && n < DesignationUtils.youngsterLevel){
            return DesignationUtils.youngsterDes;
        }else if(n >= DesignationUtils.rookieLevel && n < DesignationUtils.newPeopleLevel){
            return DesignationUtils.newPeopleDes;
        }else {
            return DesignationUtils.rookieDes;
        }
    }

}
